package com.hefei.customer.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.hefei.api.customer.manager.ISystemdefManager;
import com.hefei.api.customer.manager.impl.SystemdefManager;
import com.hefei.api.customer.vo.Systemdef;
import com.hefei.api.customer.vo.easyui.PageHelper;
import com.hefei.common.exception.ClientException;
import com.hefei.customer.service.ISystemdefService;
@Service
public class SystemdefService implements ISystemdefService {
	
	private ISystemdefManager systemdefManager = new SystemdefManager();

	@Override
	public List<Systemdef> getAll(PageHelper page) throws ClientException {
		page.setStart((page.getPage()-1)*page.getRows());
		page.setEnd(page.getPage()*page.getRows());
		return systemdefManager.getAll(page); 
	}

	@Override
	public void deleteSystemdefById(Integer systemdefId) throws ClientException {
		systemdefManager.deleteSystemdefById(systemdefId);

	}

	@Override
	public Systemdef getSystemdefById(Integer systemdefId) throws ClientException {
		return systemdefManager.getSystemdefById(systemdefId);
	}

	@Override
	public void saveSystemdef(Systemdef systemdef) throws ClientException {
		if(systemdef.getId()!=null && systemdef.getId().intValue()>0){
			systemdefManager.updateSystemdef(systemdef);
		}else{
			systemdefManager.insertSystemdef(systemdef);
		}

	}

}
